<cfsetting enablecfoutputonly="true">
<cfswitch expression="#thisTag.executionMode#">
      <cfcase value="start">
            <cfparam name="attributes.id" default="">
            <cfparam name="attributes.name" default="">
            <cfparam name="attributes.value" default="">
            <cfparam name="attributes.label" default="">
            <cfparam name="attributes.labelClass" default="coopFieldLabel">
            <cfparam name="attributes.selected" default="">
            <cfparam name="attributes.selectedValue" default="">
            <cfparam name="attributes.fieldParam" default="true">
            <cfif StructKeyExists(caller,'root')>
                  <cfset root = caller.root>
            <cfelse>
                  <cfset root = caller>
            </cfif>
            <cfif NOT thisTag.hasEndTag>
                  <cfthrow detail="End tag required" message="All coop tags require an end tag." errorcode="sos.tag.attributes">
            </cfif>
            <cfif attributes.id EQ ''>
                  <cfthrow detail="Missing required attribute: 'id'" message="'id' attribute is required">
            </cfif>
            <cfif NOT structKeyExists(root,"coop")>
                  <cfthrow detail="Missing required COOP object on calling page.">
            </cfif>
            <cfscript>
            standardAttributes = 'id,name,label,value,label,labelClass,fieldParam,selected,selectedValue';
            attributes = root.coop.mergeAttributes(attributes,root);
            attributeList = root.coop.createAttributeList(attributes,standardAttributes,root);
            if(len(attributes.selectedValue)){
                  if(attributes.value == attributes.selectedValue){
                        attributes.selected = attributes.value;
                  }
            }
            if (attributes.name EQ '') {
                  attributes.name = attributes.id;
            }
            if (attributes.fieldParam) {
                  attributes.value = root.coop.fieldParam(root._init.attributes,attributes.name,attributes.value);
            }
            if(ATTRIBUTES.selected == ATTRIBUTES.value){
                  isChecked = 'checked="checked" ';
            } else {
                  isChecked = '';
            }
            </cfscript>
      </cfcase>
      <cfcase value="end">
            <!---
            <cfsavecontent variable="formElement"><cfoutput><input #isChecked#type="checkBox" value="#attributes.value#" name="#attributes.name#" id="#attributes.id#"#attributeList#><label for="#attributes.id#" class="#attributes.labelClass#"><cfif attributes.label EQ ''>#attributes.value#<cfelse>#attributes.label#</cfif></label></cfoutput></cfsavecontent>
            <cfoutput>#formElement#</cfoutput>
			--->
			<cfscript>
			if(len(attributes.value)){
				attributes.value = thisTag.generatedContent;
			}
			formElement = '			<input #isChecked#type="checkBox" value="#attributes.value#" name="#attributes.name#" id="#attributes.id#"#attributeList#><label for="#attributes.id#" class="#attributes.labelClass#">';
			if(len(attributes.label)){
				formElement &= attributes.value;
			} else {
				formElement &= attributes.label;
			}
			formElement &= '</label>';
			writeOutput(formElement);
			</cfscript>
            <cfset thistag.generatedContent = ''>
      </cfcase>
</cfswitch>
<cfsetting enablecfoutputonly="false">